/**
 * 
 */
package com.wzz.common.callrecord.activity;

import com.hymobile.common.R;
import com.wzz.common.callrecord.CallControl;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * @author 郝清芳 电话录音模块儿，来电后自动录音，挂机后停止录音
 */
public class CallRecordMain extends Activity {
  private Button beginrecordservice, stopRecordService;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.callrecord_main);
    beginrecordservice = (Button) findViewById(R.id.startrecordservice);
    stopRecordService = (Button) findViewById(R.id.stoprecordservice);
    beginrecordservice.setOnClickListener(new BeginRecord());
    stopRecordService.setOnClickListener(new BeginRecord());
  }

  private class BeginRecord implements OnClickListener {

    @Override
    public void onClick(View v) {
      int id = v.getId();
      switch (id) {
      case R.id.startrecordservice:
        CallControl.getInstance().doStart(getApplicationContext());
        break;
      case R.id.stoprecordservice:
        CallControl.getInstance().doStop(getApplicationContext());
        break;
      }
    }
  }
}
